home *** CD-ROM | disk | FTP | other *** search
- Path: news.dal.ca!news
- From: Klaus.Eichele@Dal.Ca (Klaus Eichele)
- Newsgroups: comp.lang.c++
- Subject: Re: Strange error
- Date: Wed, 10 Apr 1996 01:27:19 GMT
- Organization: Dalhousie University
- Message-ID: <4keknp$stj@News.Dal.Ca>
- References: <1996Apr9.111558@winnie>
- NNTP-Posting-Host: rewasylishen.chem.dal.ca
- X-Newsreader: Forte Free Agent 1.0.82
-
- zhou@wmich.edu wrote:
-
- > I have been stymied by an error which occurs during run time for
- >certain programs I've written in TC++. What ever I do I cannot find the
- >cause of it. The error says something to the effect of "Floating point
- >error: Domain." or "Domain Error" and "abnormal program termination". What
- >is usually the cause of this? Thanks.
-
- Hi,
- typical sources of such errors are trigonometric functions.
- For example, if you want to know the angle corresponding to a given
- cosine and use acos(x), where x is outside the defined range (x <
- -1.0 or x > 1.0), you will get such an errors. They happen sometimes
- as a consequence of round-off errors, e.g., if the above x is obtained
- by computations. Instead of the ideal case, 1.0000000, you might get
- something slightly bigger, 1.000007. However, this will still cause
- the acos() function to bomb. Analogous problems may happen with other
- mathematical functions. Once you locate the critical function call,
- you might need to insert a test/correction, before doing the function
- call.
-
- Good Luck,
- Klaus
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Klaus Eichele keichele@is.dal.ca
- http://is.dal.ca/~keichele/keichele.html
-
-